package gold.contest;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by fanzhenyu02 on 2020/6/27.
 * common problem solver template.
 */
public class LC6009 {
    public long startExecuteTime = System.currentTimeMillis();


    class Solution {
        public int minSteps(String s, String t) {
            int[] scnt = new int[26];
            int[] tcnt = new int[26];
            for (int i = 0; i < s.length(); i++) {
                scnt[s.charAt(i) - 'a']++;
            }
            for (int i = 0; i < t.length(); i++) {
                tcnt[t.charAt(i) - 'a']++;
            }

            int ans = 0;
            for (int i = 0; i < 26; i++) {
                ans += Math.abs(scnt[i] - tcnt[i]);
            }

            return ans;
        }
    }

    public void run() {
        Solution solution = new Solution();
        System.out.println(solution.minSteps("leetcode", "coats"));
        System.out.println(solution.minSteps("night", "thing"));
    }

    public static void main(String[] args) throws Exception {
        LC6009 an = new LC6009();
        an.run();

        System.out.println("\ncurrent solution total execute time: " + (System.currentTimeMillis() - an.startExecuteTime) + " ms.");
    }
}
